package com.example.todolist.base;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Result Code Enum
 *
 * @author yinhaixiang
 */
@Getter
@AllArgsConstructor
public enum ResultCode {

    /**
     * 操作成功
     */
    SUCCESS(200, "操作成功"),

    /**
     * 操作失败
     */
    FAILURE(400, "操作失败"),

    UN_AUTHORIZED(401, "Request Unauthorized"),

    NOT_FOUND(404, "404 Not Found"),

    MSG_NOT_READABLE(400, "Message Can't be Read"),

    METHOD_NOT_SUPPORTED(405, "Method Not Supported"),

    MEDIA_TYPE_NOT_SUPPORTED(415, "Media Type Not Supported"),

    REQ_REJECT(403, "Request Rejected"),

    INTERNAL_SERVER_ERROR(500, "Internal Server Error"),

    PARAM_MISS(400, "Missing Required Parameter"),

    PARAM_TYPE_ERROR(400, "Parameter Type Mismatch"),

    PARAM_BIND_ERROR(400, "Parameter Binding Error"),

    PARAM_VALID_ERROR(400, "Parameter Validation Error"),

    // ..........  业务异常 (前端约定code>10000).............//

    /**
     * 用户session过期
     */
    USER_SESSION_EXPIRE(999, "用户session过期"),

    /**
     * 数据不存在
     */
    RECORD_NOT_FOUND_ERROR(10001, "Record Not Found"),

    /**
     * 员工没有菜单权限
     */
    USER_NO_MENU_AUTH(10002, "用户没有菜单权限"),

    /**
     * 未静默授权
     */
    UN_SILENCE_AUTH(10003, "Request Unauthorized");


    // ..........  业务异常 (前端约定code>10000) .............//


    final int code;

    final String msg;
}
